/*  1:   */ package org.jetbrains.io;
/*  2:   */ 
/*  3:   */

import com.intellij.util.SmartList;
import gnu.trove.THashMap;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */ 
/* 10:   */ public class JsonUtil
/* 11:   */ {
/* 12:   */   public static <T> List<T> nextList(JsonReaderEx paramJsonReaderEx)
/* 13:   */   {
/* 14:13 */     paramJsonReaderEx.beginArray();
/* 15:14 */     if (!paramJsonReaderEx.hasNext())
/* 16:   */     {
/* 17:15 */       paramJsonReaderEx.endArray();
/* 18:16 */       return Collections.emptyList();
/* 19:   */     }
/* 20:19 */     SmartList localSmartList = new SmartList();
/* 21:20 */     readListBody(paramJsonReaderEx, localSmartList);
/* 22:21 */     paramJsonReaderEx.endArray();
/* 23:22 */     return localSmartList;
/* 24:   */   }
/* 25:   */   
/* 26:   */   public static Object[] nextArray(JsonReaderEx paramJsonReaderEx)
/* 27:   */   {
/* 28:26 */     List localList = nextList(paramJsonReaderEx);
/* 29:27 */     return localList.toArray(new Object[localList.size()]);
/* 30:   */   }
/* 31:   */   
/* 32:   */   public static Map<String, Object> nextObject(JsonReaderEx paramJsonReaderEx)
/* 33:   */   {
/* 34:31 */     THashMap localTHashMap = new THashMap();
/* 35:32 */     paramJsonReaderEx.beginObject();
/* 36:33 */     while (paramJsonReaderEx.hasNext()) {
/* 37:34 */       localTHashMap.put(paramJsonReaderEx.nextName(), nextAny(paramJsonReaderEx));
/* 38:   */     }
/* 39:36 */     paramJsonReaderEx.endObject();
/* 40:37 */     return localTHashMap;
/* 41:   */   }
/* 42:   */   
/* 43:   */   @Nullable
/* 44:   */   public static Object nextAny(JsonReaderEx paramJsonReaderEx)
/* 45:   */   {
/* 46:42 */     switch (1.$SwitchMap$com$google$gson$stream$JsonToken[paramJsonReaderEx.peek().ordinal()])
/* 47:   */     {
/* 48:   */     case 1: 
/* 49:44 */       return nextList(paramJsonReaderEx);
/* 50:   */     case 2: 
/* 51:47 */       return nextObject(paramJsonReaderEx);
/* 52:   */     case 3: 
/* 53:50 */       return paramJsonReaderEx.nextString();
/* 54:   */     case 4: 
/* 55:53 */       return Double.valueOf(paramJsonReaderEx.nextDouble());
/* 56:   */     case 5: 
/* 57:56 */       return Boolean.valueOf(paramJsonReaderEx.nextBoolean());
/* 58:   */     case 6: 
/* 59:59 */       paramJsonReaderEx.nextNull();
/* 60:60 */       return null;
/* 61:   */     }
/* 62:62 */     throw new IllegalStateException();
/* 63:   */   }
/* 64:   */   
/* 65:   */   public static <T> void readListBody(JsonReaderEx paramJsonReaderEx, List<T> paramList)
/* 66:   */   {
/* 67:   */     do
/* 68:   */     {
/* 69:69 */       paramList.add(nextAny(paramJsonReaderEx));
/* 70:71 */     } while (paramJsonReaderEx.hasNext());
/* 71:   */   }
/* 72:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.io.JsonUtil

 * JD-Core Version:    0.7.0.1

 */